package com.xindaoapp.happypet.activity;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

import com.xindaoapp.happypet.R;

public class AboutActivity extends UMBaseActivity {
    private ImageView tittle_common_cancel;
    private TextView tittle_common_content;
    private TextView about_version;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);
        tittle_common_cancel = (ImageView) findViewById(R.id.tittle_common_cancel);
        tittle_common_content = (TextView) findViewById(R.id.tittle_common_content);
        about_version = (TextView) findViewById(R.id.about_version);
        tittle_common_content.setText("关于尾巴圈");
        tittle_common_cancel.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        about_version.setText(getVersion());
    }

    private String getVersion() {
        PackageManager manager = getPackageManager();
        try {
            PackageInfo pm = manager.getPackageInfo(getPackageName(), 0);
            String versionName = pm.versionName;
            return versionName;
        } catch (NameNotFoundException e) {
            e.printStackTrace();
            return "";
        }
    }

}
